<template>
  <div class="lesson-discuss">
    <div class="option clearfix">
      <div v-if="!writeDiscuss" @click="writeDiscuss = true" class="fr flex-center btn">
        <img
          src="../../../../../../assets/image/onlineStudent/discuss-ico.png"
          alt=""
        />
        发布评论
      </div>
      <div v-else class="write-discuss">
        <el-input
          type="textarea"
          resize="none"
          :rows="4"
          v-model="textarea"
        >
        </el-input>
        <div class="info">
          <div class="left">
            课程评分
          <el-rate class="rate" v-model="value"></el-rate>
          </div>
          <div class="right">
            <el-checkbox v-model="checked">匿名发布</el-checkbox>
            <div @click="writeDiscuss = false" class="check-default cancel btn">取消</div>
            <div @click="writeDiscuss = false" class="check-default check-active sub btn">发布</div>
          </div>

        </div>
      </div>
    </div>
    <div v-if="discussLists !== 0" class="discuss-content">
      <ul class="discuss-list">
        <li v-for="(item, index) in discussLists" :key="index">
          <div class="left">
            <img
              src="../../../../../../assets/image/onlineStudent/discuss-img.png"
              alt=""
            />
          </div>
          <div class="right">
            <div class="title">
              小明同学
              <el-rate
                class="rate"
                v-model="value"
                disabled
                text-color="#ff9900"
              >
              </el-rate>
            </div>
            <div class="discuss-content">老师讲的太快了</div>
            <div class="info">
              <div class="time">2020-06-26 13:53:08</div>
              <div class="chapter">
                课次：健康管理理论基础 第4章 常见慢性病 第七节--第八节
              </div>
            </div>
          </div>
        </li>
      </ul>
      <div class="pagination" id="pagination">
        <el-pagination
          background
          :page-size="100"
          layout="prev, pager, next, jumper"
          :total="1000"
        >
        </el-pagination>
      </div>
    </div>
    <div class="discuss-none" v-else>
      <div>
        <img
          src="../../../../../../assets/image/onlineStudent/discuss-none.png"
          alt=""
        />
      </div>
      此课程暂时没有评论
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: 3,
      textarea: '',
      discussLists: 7,//TODO:为0显示暂无评论，否则显示列表
      checked:false,
      writeDiscuss:false
    }
  },
}
</script>

<style lang="less" scoped>
@import '../../../../common/index.less';
.lesson-discuss {
  .option .fr {
    margin: 10px;
    padding: 5px 8px;
    border: solid 1px #27a4fe;
    color: #27a4fe;
    img {
      margin-right: 5px;
    }
  }
  .info{
    margin-top: 10px;
    .flex(space-between, center);
    .left{
      .flex();
      .rate{
        margin-left: 10px;
      }
    }
    .right{
      .flex('',center);
      .cancel{
        margin-left: 20px;
        margin-right: 7px;
      }
    }
  }
  li {
    .flex('', center);
    padding: 15px 0;
    border-bottom: solid 1px #e4e7ed;
    .right {
      width: 100%;
      margin-left: 10px;
    }
    .title {
      .flex();
      .rate {
        margin: 0 10px;
      }
    }
    .discuss-content {
      margin: 7px 0;
      color: #666666;
    }
    .info {
      .flex(space-between, center);
      font-size: 12px;
      color: #999999;
    }
  }
  .discuss-none {
    margin-top: 200px;
    text-align: center;
  }
}
</style>
